//---------------------------------------------------------------------------

#include "http_postdata.h"
#include "../url_encode/urlencode.h"

//---------------------------------------------------------------------------


std::string http_postdata::make_str() {
        int str_count = this->GetCount();
        std::string result;
        if (str_count > 0) {
                std::string name;
                std::string value;
                for (int i = 0; i<str_count; i++) {
                        if (i > 0) result.append("&");
                        name = this->GetName(i);
                        value = this->GetValue(i);
                        /*
                        result.append(name);
                        result.append("=");
                        result.append(value);
                        */
                        result.append( urlencode(name) );
                        result.append("=");
                        result.append( urlencode(value)) ;
                        
                }
        }
        return result;
}
